package view
{
	import flash.events.Event;
	
	import manager.ObjectPool;
	import manager.TankName;
	
	import view.base.BaseView;
	import view.tank.BaseTank;
	
	public class MouseTipView extends BaseView
	{
		private var mouseTip:BaseTank;
		
		public var _type:String;
		
		public function MouseTipView()
		{
			super();
			this.mouseChildren =false;
			this.mouseEnabled = false;
		}
		
		override protected function loop(event:Event):void{
			if(mouseTip){
				mouseTip.x = mouseX;
				mouseTip.y = mouseY;
			}
		}
		
		public function show(type:String):void{
			_type = type;
			mouseTip = ObjectPool.getObj(TankName.getTankCls(type)) as BaseTank;
			this.addChild(mouseTip);
		}
		
		public function hide():void{
			if(this.parent){
				this.removeChild(mouseTip);
				mouseTip = null;
				_type = null;
				this.parent.removeChild(this);
			}
		}
	}
}